package com.easyWeb.context;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BaseContext<T>{
    private ThreadLocal<T> threadLocal;
    private Class<T> type;

    public BaseContext(Class<T> type) {
        log.info("BaseContext 初始化中");
        this.threadLocal = new ThreadLocal<T>();
        this.type = type;
    }

    public void set(T value) {
        log.info("容器中设置当前值{}", threadLocal.get());
        threadLocal.set(value);
    }

    public T get() {
        log.info("容器中获取当前值{}", threadLocal.get());
        return threadLocal.get();
    }

    public void remove() {
        log.info("容器中移除当前值{}", threadLocal.get());
        threadLocal.remove();
    }


}
